import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/23 16:12
 */

public class Solution {
    public int pivotIndex(int[] nums) {
        int n = nums.length;
        int[] f = new int[n];
        int[] g = new int[n];

        //预处理前缀和数组
        for (int i = 1; i < n; i++) {
            f[i] = f[i - 1] + nums[i - 1];
        }
        for (int i = n - 2; i >= 0; i--) {
            g[i] = g[i + 1] + nums[i + 1];
        }

        for (int i = 0; i < n; i++) {
            if (f[i] == g[i]) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int len = in.nextInt();
            int[] nums = new int[len];
            for(int i = 0;i < len;i++){
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.pivotIndex(nums));
        }
    }
}